package org.example.designPattern.creation.factory;

import org.example.designPattern.creation.factory.v1.PizzaStoreV1;
import org.example.designPattern.creation.factory.v2.PizzaStoreV2;
import org.example.designPattern.creation.factory.v2.SimpleFactoryA;
import org.example.designPattern.creation.factory.v3.BSKPizzaFactory;
import org.example.designPattern.creation.factory.v3.PizzaStoreV3;

/*
*  什么是工厂模式
*
* */
public class Test {

    public static void main(String[] args) {

        /*
        * 简单工厂： 通过传入的参数决定返回的对象
        * */
//        System.out.println("-----------简单工厂------------------");
//        PizzaStoreV1 pizzaStoreV1 = new PizzaStoreV1(new SimpleFactory());
//        Piz piz = pizzaStoreV1.getPizza("3");

        /*
        * 工厂方法：将创建对象的逻辑下沉到子类
        * */
//        System.out.println("-----------普通工厂------------------");
//        SimpleFactory simpleFactory = new SimpleFactoryA();
//        PizzaStoreV2 pizzaStoreV2 = new PizzaStoreV2(simpleFactory);
//        Piz piz = pizzaStoreV2.getPizza("3");

        /*
        * 抽线工厂方法：工厂中维护产品簇，使同一种类产品的新增更加方便
        * */
        System.out.println("-----------抽象工厂------------------");
        PizzaStoreV3 pizzaStoreV3 = new PizzaStoreV3(new BSKPizzaFactory());

        System.out.println("获得的面团产品：" + pizzaStoreV3.getDough());
    }

    /*
     *   简单工厂
     * */


    /*
    * 工厂方法
    * */


    /*
    * 抽象方法
    * */
}
